#!/bin/sh

if [ -n "`%OPTWARE_TARGET_PREFIX%/bin/pidof statd`" ]; then 
    %OPTWARE_TARGET_PREFIX%/bin/killall statd 2>/dev/null
fi

if [ -n "`%OPTWARE_TARGET_PREFIX%/bin/pidof nfsd`" ]; then 
    %OPTWARE_TARGET_PREFIX%/bin/killall nfsd 2>/dev/null
fi

if [ -n "`%OPTWARE_TARGET_PREFIX%/bin/pidof mountd`" ]; then 
    %OPTWARE_TARGET_PREFIX%/bin/killall mountd 2>/dev/null
fi

if [ ! -d /var/lib/nfs ] ;  then
    mkdir -p /var/lib/nfs
fi

/bin/rm -f /etc/exports
/bin/ln -s %OPTWARE_TARGET_PREFIX%/etc/exports /etc/exports

touch /var/lib/nfs/etab
touch /var/lib/nfs/rmtab

%OPTWARE_TARGET_PREFIX%/sbin/statd
%OPTWARE_TARGET_PREFIX%/sbin/exportfs -r
%OPTWARE_TARGET_PREFIX%/sbin/nfsd
%OPTWARE_TARGET_PREFIX%/sbin/mountd
